from bs4 import BeautifulSoup


class HTMLTableParser:
    def __init__(self, html):
        self.soup = BeautifulSoup(html, 'html.parser')

    def parse_table(self, table_id):
        table = self.soup.find('table', {'id': table_id})
        if table:
            rows = table.find_all('tr')
            num_rows = len(rows)
            num_cols = max(len(row.find_all(['th', 'td'])) for row in rows)

            data = [[None for _ in range(num_cols)] for _ in range(num_rows)]

            for i, row in enumerate(rows):
                columns = row.find_all(['th', 'td'])
                for j, col in enumerate(columns):
                    data[i][j] = col.text.strip()

            return Table(data)
        else:
            print(f"Table with id '{table_id}' not found.")


class Table:
    def __init__(self, data):
        self.data = data

    def display_table(self):
        for row in self.data:
            print(row)


# 示例用法
html_content = """
<table id="dvccFundList" class="list dataTable no-footer" role="grid" aria-describedby="dvccFundList_info">
							<thead>
							<tr id="personColumns" role="row"><th width="8%" class="sorting_disabled center" rowspan="1" colspan="1">序号</th><th id="orgName1" width="20%" class="sorting_disabled center" rowspan="1" colspan="1" style="width: 30%;">机构名称</th><th id="orgType1" width="20%" class="sorting_disabled center" rowspan="1" colspan="1" style="width: 30%;">机构类型</th><th id="total" width="10%" class="sorting_disabled center" rowspan="1" colspan="1" style="width: 17%;">员工人数</th><th id="workerTotalNum" width="10%" class="sorting_disabled center" rowspan="1" colspan="1" style="width: 17%;">基金从业资格</th></tr>
							</thead>
						<tbody><tr role="row" class="odd"><td class=" center">1</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109381035" target="_blank">阿比垂直（武汉）私募基金管理有限公司</a></td><td class=" center">私募证券投资基金管理人</td><td class=" center">11</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109381035" target="_blank">10</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="even"><td class=" center">2</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109410488" target="_blank">阿尔法未来（北京）投资管理有限公司</a></td><td class=" center">私募证券投资基金管理人</td><td class=" center">5</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109410488" target="_blank">5</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="odd"><td class=" center">3</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109406981" target="_blank">爱凡哲投资管理有限公司</a></td><td class=" center">私募证券投资基金管理人</td><td class=" center">26</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109406981" target="_blank">25</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="even"><td class=" center">4</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109216723" target="_blank">艾格（天津）股权投资基金管理有限公司</a></td><td class=" center">私募股权、创业投资基金管理人</td><td class=" center">18</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109216723" target="_blank">15</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="odd"><td class=" center">5</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109291366" target="_blank">爱杭私募基金管理（安徽）有限公司</a></td><td class=" center">私募股权、创业投资基金管理人</td><td class=" center">16</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109291366" target="_blank">16</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="even"><td class=" center">6</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109221408" target="_blank">爱晖资产管理(上海)有限公司</a></td><td class=" center">私募证券投资基金管理人</td><td class=" center">14</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109221408" target="_blank">14</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="odd"><td class=" center">7</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109595127" target="_blank">爱诺投资管理（南京）有限公司</a></td><td class=" center">私募股权、创业投资基金管理人</td><td class=" center">6</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109595127" target="_blank">3</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="even"><td class=" center">8</td><td class=" center"><a class="ajaxify" href="personList.html?userId=2007171412042047" target="_blank">阿基米德私募基金管理（河南）有限公司</a></td><td class=" center">私募证券投资基金管理人</td><td class=" center">11</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=2007171412042047" target="_blank">11</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="odd"><td class=" center">9</td><td class=" center"><a class="ajaxify" href="personList.html?userId=2211081449109971" target="_blank">阿克苏地区绿诚私募股权投资基金管理有限公司</a></td><td class=" center">私募股权、创业投资基金管理人</td><td class=" center">5</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=2211081449109971" target="_blank">5</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr><tr role="row" class="even"><td class=" center">10</td><td class=" center"><a class="ajaxify" href="personList.html?userId=1701006109218855" target="_blank">阿拉丁资产管理（北京）有限公司</a></td><td class=" center">私募股权、创业投资基金管理人</td><td class=" center">38</td><td class=" center"><a class="ajaxify" href="operPersonList.html?userId=1701006109218855" target="_blank">33</a></td><td class=" center"></td><td class=" center"></td><td class=" center"></td></tr></tbody></table>
"""

parser = HTMLTableParser(html_content)
parsed_table = parser.parse_table('dvccFundList')

if parsed_table:
    parsed_table.display_table()
